#include <iostream>
#include <cmath>
#define maxn 100
using namespace std;
int IsTheNumber ( const int num );

int main()
{
    int n1, n2, i, cnt;
	
    cin>>n1;cin>>n2;
    cnt = 0;
    for ( i=n1; i<=n2; i++ ) {
        if ( IsTheNumber(i) )
            cnt++;
    }
    printf("cnt = %d\n", cnt);

    return 0;
}
int IsTheNumber ( const int num ){
	int i,j;
	int numarg=num;
	for(i=0;i<=sqrt(numarg);i++){
		if(i*i==numarg){
			int a[12],t=0;
			while(numarg!=0){				
				a[t]=numarg%10;
				numarg/=10;
				t++; 
			}
			for(int j=0;j<t-1;j++){
				for(int k=j+1;k<t;k++){
					if(a[j]==a[k]&&j!=k){
						return 1;
					}
				}
			}
		}
	}
	return 0;
}
